#include "Cilindro.h"

using namespace  std;

Cilindro::Cilindro(Materiais *mat, Texturas *tex, float base, float top, float height, int slices, int stacks) : Primitiva(mat, tex){

	this->base = base;
	this->top = top;
	this->height = height;
	this->slices = slices;
	this->stacks = stacks;

	qua = gluNewQuadric();
	gluQuadricNormals(qua, GLU_SMOOTH);
	gluQuadricDrawStyle(qua, GLU_FILL);                        
	gluQuadricOrientation(qua, GLU_OUTSIDE);
	gluQuadricTexture(qua, GL_TRUE);
}

void Cilindro::aplica() {
	glPushMatrix();
	glEnable(GL_NORMALIZE);
	this->getMaterial()->aplica();
	this->getTextura()->aplica();

	gluCylinder(qua, base, top, height,slices, stacks);
	glDisable(GL_NORMALIZE);
	glPopMatrix();
}